<template>
  <div class="login flex-row-center" v-loading="loding">
    <div class="login-form flex-column-center">
      <div class="login-logo"></div>
      <el-form :model="form" :rules="rules" size="large">
        <el-form-item label="" prop="username">
          <el-input v-model="form.username" :maxlength="50" placeholder="请输用户名">
            <template #prefix><Icon icon="user" /></template>
          </el-input>
        </el-form-item>
        <el-form-item label="" prop="password">
          <el-input type="password" v-model="form.password" :maxlength="50" placeholder="请输入密码">
            <template #prefix><Icon icon="lock" /></template>
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="signIn" class="btn-login">找回密码</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import BaseComponent from "@/application/BaseComponent.vue";

export default {
  extends: BaseComponent,
  data() {
    return {
      loding: false,
      form: {},
      rules: {}
    };
  },
  computed: {},
  created() {},
  mounted() {},
  methods: {
    signIn() {
      this.loding = true;
      this.$g.ajax.$api("user.login", this.form).then((result) => {
        console.log(result);
        this.loding = false;
        if (result.code == 0) {
          this.$router.push("/");
        }
      });
    }
  }
};
</script>

<style>
.login {
  background: url(/img/login-back.png) no-repeat;
  background-size: cover;
  flex-grow: 1;
  overflow: auto;
  justify-content: center;
}
.login-logo {
  background-color: #ffffff;
  background-image: url(/img/logo.svg);
  background-size: auto 60%;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: none;
  border-radius: 100%;
  height: 120px;
  width: 120px;
  position: absolute;
  top: -60px;
  left: calc(50% - 50px);
}
.login-form {
  position: relative;
  max-width: 460px;
  max-height: 320px;
  min-width: 360px;
  min-height: 300px;
  width: 66vh;
  height: 45vh;
  background: #ffffff;
  box-shadow: 18px 18px 36px 1px rgba(0, 0, 0, 0.09);
  border-radius: 20px 20px 20px 20px;
  padding: 40px;
  padding-bottom: 2%;
  justify-content: flex-end;
}
.login-form .el-form {
  width: 100%;
}
.btn-login {
  width: 100%;
}
.login-form .action {
  width: 100%;
  margin-bottom: 10px;
}
</style>
